package org.reenscape.skill;
import org.reenscape.model.PacketParser;

public class Fletching {
//1248 = Fletching emote

			public void CutLogs(PacketParser p3){
				p3.deleteItem(1511, p3.GetItemSlot(1511), 1);
				p3.Animation(1248);
				p3.sendMessage("You carefully cut the logs into 15 arrow shafts.");
				p3.addSkillXP((0.33 * 15), Skill.FLETCHING);
				p3.addItem(52, 15);
			}
			
			public void ChooseBow(int id, PacketParser p3){
				String n = null;
				int d = 0;
				switch(id){
					case 2511:		n = "";			d = 2511;		break;
					case 1521:		n = "Oak";		d = 1521;		break;
					case 1519:		n = "Willow";	d = 1519;		break;
					case 1517:		n = "Maple";	d = 1517;		break;
					case 1515:		n = "Yew";		d = 1515;		break;
					case 1513:		n = "Magic";	d = 1513;		break;
					default: return;
				}
					choose(n, p3);
					p3.bow = d;
			}
			
			public void MakeBow(int id, int type, PacketParser p3){
				if(id == -1) return;
				int xp = 0;
				int required = 0;
				int endItem = 0;
				switch(id){
					case 2511:		if(type == 0){ xp = 10; required = 5; endItem = 50;} else { xp = 20; required = 10; endItem = 48;} break;
					case 1521:		if(type == 0){ xp = 33; required = 20; endItem = 54;} else { xp = 50; required = 25; endItem = 56;} break;
					case 1519:		if(type == 0){ xp = 66; required = 35; endItem = 60;} else { xp = 83; required = 40; endItem = 58;} break;
					case 1517:		if(type == 0){ xp = 100; required = 50; endItem = 64;} else { xp = 116; required = 55; endItem = 62;} break;
					case 1515:		if(type == 0){ xp = 133; required = 65; endItem = 68;} else { xp = 150; required = 70; endItem = 66;} break;
					case 1513:		if(type == 0){ xp = 166; required = 80; endItem = 72;} else { xp = 183; required = 85; endItem = 70;} break;
					default: return;
				}
				if(p3.playerLevel[p3.playerFletching] >= required){
					p3.Animation(1248);
					p3.addSkillXP(xp, 9);
					p3.deleteItem(id, p3.GetItemSlot(id), 1);
					p3.addItem(endItem, 1);
				} else {
					p3.sendMessage("You need a Fletching level of "+required+" to make that bow.");
				}
			}
			
			public void StringBow(int bow, PacketParser p3){
				int endItem = 0;
				int required = 0;
				switch(bow){
					case 50:			endItem = 841;			required = 5;			break;
					case 48:			endItem = 839;			required = 10;			break;
					case 54:			endItem = 843;			required = 20;			break;
					case 56:			endItem = 845;			required = 25;			break;
					case 60:			endItem = 849;			required = 35;			break;
					case 58:			endItem = 847;			required = 40;			break;
					case 64:			endItem = 853;			required = 50;			break;
					case 62:			endItem = 851;			required = 55;			break;
					case 68:			endItem = 857;			required = 65;			break;
					case 66:			endItem = 855;			required = 70;			break;
					case 72:			endItem = 861;			required = 80;			break;
					case 70:			endItem = 859;			required = 85;			break;
					default: return;
				}
				
				if(p3.playerLevel[p3.playerFletching] >= required){
					p3.Animation(1248);
					p3.deleteItem(bow, p3.GetItemSlot(bow), 1);
					p3.addItem(endItem, 1);
					p3.sendMessage("You string the bow.");
					p3.bow = -1;
				} else {
					p3.sendMessage("You need a Fletching level of "+required+" to string that bow.");
				}
			}
			
			public void choose(String name, PacketParser p3){
				p3.sendFrame171(1, 2465);
				p3.sendFrame171(0, 2468);
				p3.sendFrame126("Select an Option", 2460);
				p3.sendFrame126(name + " Short Bow", 2461);
				p3.sendFrame126(name + " Long Bow", 2462);
				p3.sendFrame164(2459);
				p3.NpcDialogueSend = true;
			}
}